package com.kinon.ogt.view.fragments;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.kinon.ogt.R;
import com.kinon.ogt.utils.SPrefsUtils;
import com.kinon.ogt.view.activities.SignInActivity;

import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;

/**
 * 佛祖保佑 永无BUG
 *
 * @author WangZhiYao
 * @date 2018/4/28
 */
public class IntroThreeFragment extends Fragment {

    private Unbinder mUnBinder;

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_intro_three, container, false);
        mUnBinder = ButterKnife.bind(this, rootView);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        mUnBinder.unbind();
    }

    @OnClick(R.id.btn_intro)
    public void onViewClicked() {
        if (IntroThreeFragment.this.getActivity() != null) {
            SPrefsUtils.writeFirstRun(false);
            startActivity(new Intent(IntroThreeFragment.this.getActivity(), SignInActivity.class));
            IntroThreeFragment.this.getActivity().finish();
        }
    }
}
